package com.ccxe.manage.service;

import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.ccxe.manage.dao.impl.IM_Menu_Role_DaoImpl;
import com.ccxe.manage.dao.impl.UserDaoImpl;
import com.ccxe.manage.model.UserBean;

public class UserAccseeControlList {

	private UserBean userBean;
	private String accseeList;
	
	public UserAccseeControlList(String username){
		try {
			setUserBean(username);
			accseeList = getAccseeList(username);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private void setUserBean(String username) {
		this.userBean = new UserDaoImpl().getByIdIsExsit(username);
	}
	
	private String getAccseeList(String username) throws Exception {
		List<Map<?,?>> list  = (new IM_Menu_Role_DaoImpl()).getTreeListByUsername(username);
		StringBuffer sb = new StringBuffer();
//		if(list == null && list.size() <= 0) {
//			return "";
//		}
//		for (int i = 0; i < list.size() ; i++ ) {
//			for (Map.Entry<?, ?> m : list.get(i).entrySet()) {
//				if("URL".equals(m.getKey())){
//				}
//				System.out.println("---"+ +" :"+m.getValue());
//				sb.append(m.getValue()+"/");
//			}
//			
//		}
		sb.append("/crawler/dataList.jsp" +",")
			.append("/crawler/showPage.jsp,")
			.append("/crawler/addWebsite.jsp,");
		return sb.toString();
	}
	
	public UserBean getUserBean() {
		return userBean;
	}
	public String getAccseeList() {
		return accseeList;
	}
}
